package com.smart.service;

import com.smart.dao.LessonDao;
import com.smart.dao.TeacherDao;
import com.smart.domain.Lesson;
import com.smart.domain.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherService {

    @Autowired
    TeacherDao teacherDao;
    @Autowired
      LessonDao lessonDao;

    @Autowired
    public void setTeacherDao(TeacherDao teacherDao) {
        this.teacherDao = teacherDao;
    }


    public boolean hasMatchUser(String name,String password) {
        int matchCount = teacherDao.getMatchCount(name,password);
        return matchCount > 0;
    }


    public Teacher  queryteacher(String name)
    {
       return teacherDao.queryteacher(name);
    }

    public List<Teacher> getbyteachernameandps(String  name,String password)
    {
        List<Teacher> list =teacherDao.getbyteachernameandps(name, password);
        return list;
    }


    public   void  addlesson(Lesson lesson){
     lessonDao.add(lesson);
    }

    public Lesson querylesson(){
         return  lessonDao.querylistCompRoom();


    }

}
